Transient fault detection by integrating an SRMT code and a non SRMT code in a single application

ABSTRACT

Disclosed is a method for running a first code generated by a Software-based Redundant Multi-Threading (SRMT) compiler along with a second code generated by a normal compiler at runtime, the first code including a first function and a second function, the second code including a third function. The method comprises running the first function in a leading thread and a tailing thread ( 104 ); running the third function in a single thread ( 106 ), the leading thread calls the third function and running the second function in the leading thread and the tailing thread ( 108 ), the third function calls the second function. The present disclosure provides a mechanism for handling function calls wherein SRMT functions and binary functions can call each other irrespective of whether the callee function is a SRMT function or a binary function and thereby dynamically adjusts reliability and performance tradeoff based on run-time information and user selectable policies.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a Continuation In Part of U.S. application Ser. No. 11/745,403 entitled, “TRANSIENT FAULT DETECTION BY INTEGRATING AN SRMT CODE AND A NON SRMT CODE IN A SINGLE APPLICATION”, filed on May 7, 2007.

FIELD

The present disclosure relates generally to transient fault detection using Software-based Redundant Multi-Threading (SRMT) approach, and more particularly to running a SRMT code along with a Non SRMT code for transient fault detection.

BRIEF DESCRIPTION OF THE DRAWINGS

The advantages and features of the present disclosure will become better understood with reference to the following detailed description and claims taken in conjunction with the accompanying drawings, wherein like elements are identified with like symbols, and in which:

FIG. 1 is a flowchart illustrating a method for running a first code generated by a Software-based Redundant Multi-Threading (SRMT) compiler along with a second code generated by a normal compiler at runtime;

FIG. 2 is scenario illustrating a SRMT function calling a binary function, and the binary function calling another SRMT function;

FIG. 3 illustrates code generation depicting handling of call to and call back from a normal function; and

FIG. 4 illustrates code for leading, trailing and EXTERN versions of _setjmp and _longjmp operations.

Like reference numerals refer to like parts throughout the description of several views of the drawings.

DETAILED DESCRIPTION

For a thorough understanding of the present disclosure, refer to the following detailed description, including the appended claims, in connection with the above-described drawings. Although the present disclosure is described in connection with exemplary embodiments, the disclosure is not intended to be limited to the specific forms set forth herein. It is understood that various omissions and substitutions of equivalents are contemplated as circumstances may suggest or render expedient, but are intended to cover the application or implementation without departing from the spirit or scope of the claims of the present disclosure. Also, it is to be understood that the phraseology and terminology used herein is for the purpose of description and should not be regarded as limiting.

The terms “first,” “second,” and the like, herein do not denote any order, quantity, or importance, but rather are used to distinguish one element from another, and the terms “a” and “an” herein do not denote a limitation of quantity, but rather denote the presence of at least one of the referenced item.

The present disclosure provides for a method for transient fault detection by integrating code generated by a Software-based Redundant Multi-Threading (SRMT) compiler with code generated by a non-SRMT/normal compiler. By integrating code generated by a SRMT compiler with code generated by a non-SRMT compiler, the present disclosure reduces the overhead involved in recompilation of the functions having built-in reliability features. Additionally, the present disclosure also addresses the concerns of applications having part of the code that users consider unnecessary with redundant computation. For example in audio and video applications, the present disclosure eliminates the need for recompiling the code, thereby enhancing the real-time requirements of the aforesaid code. Furthermore, the implementation of the present disclosure eliminates the need for recompilation of applications invoking third party library code without a source. The present disclosure provides for a uniform mechanism for handling function calls such that SRMT functions and binary functions can freely call each other irrespective of whether the callee function is a SRMT function or a binary function. The present disclosure thereby dynamically adjusts the application reliability and performance tradeoff based on run-time information and user selectable policies.

As used hereinafter, binary functions are referred to parts of a program that are not compiled for SRMT and a part of the program compiled for SRMT collectively is referred to as SRMT functions. Furthermore, the code generated by the SRMT compiler is referred to as SRMT code.

When an SRMT function is compiled, typically two different versions of a function are generated—a leading version and a tailing version. The leading version may be executed in a leading thread and the tailing version may be executed in a tailing thread. In addition, an SRMT compiler consistent with the present disclosure may be configured to generate an EXTERN version. The EXTERN version may be called directly by a binary function. The present disclosure seamlessly integrates binary functions into SRMT, by running binary function in one thread, e.g. the leading thread, and thereby skipping running the other thread, e.g. the tailing, for possible non-repeatable side effects of the binary function.

Even if one can generate different code sequences for function calls to run different versions of SRMT functions in different threads and run binary functions in only one thread, the compiler may not statically know whether a callee function is actually a binary function or not in the presence of the function pointers and separate compilation. The present disclosure provides an SRMT compiler that ensures the code generated by the SRMT compiler works irrespective of whether a callee function is a binary function or not. Furthermore, without making modifications to the binary functions, the present disclosure ensures that the SRMT functions called by binary functions run in different threads with different versions.

The present disclosure provides for a mechanism wherein the SRMT code and binary function can interact with each other in the same application. The SRMT compiler generates code in a manner such that the SRMT function running in two threads calls a binary function to run in one thread only, and the binary function calls back to another SRMT function, which will again be run by both the threads.

Now, referring to FIGS. 1 and 2, illustrated is a method for executing SRMT functions and binary functions. Additionally, the figures also illustrate a scenario showing a SRMT function calling a binary function and the binary function thereafter calling another SRMT function. The SRMT functions main ( ) and bar ( ) described in 202 of FIG. 2 comprise the first code generated by the SRMT compiler. The second code generated by the binary compiler corresponds to the function bar2 ( ) described in 202 in FIG. 2. At operation 102 of FIG. 1, the method is initiated once a request for running the first function. At operation 104, the first function is run in a leading thread and a tailing thread, represented as 204 wherein the first function corresponds to the function main ( ) in FIG. 2. The first function calls the third function, wherein the third function corresponds to the function bar2 ( ). At operation 106, the third function is run in a single thread represented as 206, since the third function is a binary function, therefore it is run in the single thread 206. The third function calls the second function, the second function corresponds to function bar ( ). At operation 108 the second function is run in the leading thread and the tailing thread represented as 208. At operation 110, the method is terminated after the first function completes execution.

The calling of the binary functions by the SRMT functions, for example, the first function calling the third function is implemented by calling the third leading function executed by the leading thread and sending the return results to the first tailing function executed by the tailing thread. The first tailing thread uses the result without calling the third tailing function.

The calling of the SRMT functions by the binary functions, for example, the third function calling the second function is implemented by using an extern version, a wrapper, of the SRMT function in addition to the leading version and the tailing version of the SRMT function. The extern version has the same prototype as the original non-SRMT function, such that, it can be directly called by the binary function. When an extern version is called by the binary function, the extern version not only executes the leading version of the SRMT function on the leading thread, but also requests the tailing thread to execute the tailing version of the SRMT function.

Referring to FIG. 3. illustrated is a code generation depicting handling of call to and call back from a non-SRMT function. FIG. 3 is described with reference to the first code and the second code 202 in FIG. 2. FIG. 3 shows the SRMT code capable of handling call to and call back from binary functions for the first code and the second code 202. As shown in FIG. 3, Leading_main ( ) calls binary function bar2 ( ). The Leading_main ( ) sends the END_CALL and the return value ‘ret’ to the tailing thread after the function call returns as shown at block 302. Tailing_main ( ) waits in a wait_for_notification loop until it receives END_CALL, as shown at block 304. When the binary function bar2 ( ) calls back SRMT function bar ( ), the EXTERN version of function bar ( ) notifies the tailing thread by sending the corresponding function pointer tailing_bar and the corresponding parameters to the tailing thread so that the tailing thread can correctly make a call to tailing_bar with the function pointer and parameters, as shown at block 306.

The EXTERN version of function bar ( ) assumes that there always exists a corresponding tailing thread running in the wait_for_notification loop. This is true if function bar ( ) is always (nested) called by a SRMT function (in this case function main ( )). In case that the function bar ( ) may not be (nested) called by any SRMT function, a runtime checking in the EXTERN version of function bar ( ) is added and a new thread is forked to run the tailing_bar if there is no corresponding tailing thread running.

The above scheme also works for function calls through pointers. A function pointer points to either an EXTERN version of a SRMT function or a binary function. The SRMT compiler generates code as if the indirect call is to a binary function (for example. the code similar to those shown in blocks 302 and 304). If the callee function turns out to be a SRMT function, its EXTERN function will be called, which in turn calls the leading function and notifies the tailing thread to execute the tailing function.

FIG. 4 illustrates code for leading, trailing and EXTERN versions of _setjmp and _longjmp operations. The control flow outside the SRMT functions occur when there is a special non-return or abnormal-return function such as setjmp, longjmp and exit. The present disclosure provides versions of the above functions, such that these versions can be called by either an SRMT function or a binary function. FIG. 4 shows leading 402, tailing 404, and EXTERN 406 versions of setjmp and longjmp, where _setjmp and _longjmp represent the inlined common bodies of the setjmp and longjmp, respectively. The leading and tailing versions of the setjmp/longjmp uses different environments, such that, the leading longjmp jumps to the environment (env) set by the leading setjmp, and the tailing longjmp jumps to the environment (new_env) set by the tailing setjmp. A hash table is maintained in the tailing thread for mapping the environments between the leading thread and the tailing thread. The hash_alloc function allocates a new entry in the hash table and the hash_lookup function searches the hash table for an entry. When the leading thread calls a binary function, such as bar2 ( ) which in turn calls an EXTERN version of setjmp or longjmp, the EXTERN version of setjmp or longjmp notifies the tailing thread to run the TAILING version of these functions and also performs the setjmp or longjmp operations for the leading thread. Further, when the EXTERN version of setjmp/longjmp is called, the tailing thread executes the wait_for_notification loop at the call site of the binary function bar2 ( ) as shown in block 304.

As described above, the embodiments of the disclosure may be embodied in the form of computer-implemented processes and apparatuses for practicing those processes. Embodiments of the disclosure may also be in the form of computer program code containing instructions embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other computer-readable storage medium, wherein, when the computer program code is loaded into and executed by a computer, the computer becomes an apparatus for practicing the disclosure. The present disclosure can also be embodied in the form of computer program code, for example, whether stored in a storage medium, loaded into and/or executed by a computer, or transmitted over some transmission medium, such as over electrical wiring or cabling, through fiber optics, or via electromagnetic radiation, wherein, when the computer program code is loaded into and executed by a computer, the computer becomes an apparatus for practicing the disclosure. When implemented on a general-purpose microprocessor, the computer program code segments configure the microprocessor to create specific logic circuits.

The foregoing descriptions of specific embodiments of the present disclosure have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the disclosure to the precise forms disclosed, and obviously many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the disclosure and its practical application, to thereby enable others skilled in the art to best utilize the disclosure and various embodiments with various modifications as are suited to the particular use contemplated. It is understood that various omissions and substitutions of equivalents are contemplated as circumstance may suggest or render expedient, but are intended to cover the application or implementation without departing from the spirit or scope of the claims of the present disclosure. 

1. A method for running a first code generated by a Software-based Redundant Multi-Threading (SRMT) compiler along with a second code generated by a non-SRMT compiler, the first code including a first function and a second function, the second code including a third function, the method comprising: running the first function in a leading thread and a tailing thread; running the third function in a single thread, wherein the leading thread calls the third function; running the second function in the leading thread and the tailing thread, wherein the third function calls the second function; and running leading and tailing versions of a setjmp or longjmp operation and maintaining a hash table in the tailing version for providing control flow outside the first function, the second function and the third function.
 2. The method of claim 1, wherein running the third function in the single thread further comprises sending a return result by the leading thread to the tailing thread.
 3. The method of claim 1, wherein running the second function in the leading thread and the tailing thread comprises: calling an extern version of the second function by the third function, wherein the extern version of the second function is a wrapper of the second function and is configured to be called directly by the third function; and running the second function in the leading thread and the tailing thread by the extern version of the second function.
 4. The method of claim 1, wherein running the first code generated by the SRMT compiler along with the second code generated by the non-SRMT compiler is used for transient fault detection.
 5. The method of claim 1, wherein the second function comprises instructions capable of invoking a third party library code.
 6. The method of claim 1, wherein the second function comprises instructions for playing audio and video.
 7. The method of claim 1, wherein the third function is called by the first function through a pointer.
 8. The method of claim 1, wherein the second function is called by the third function through a pointer.
 9. A method for running functional calls between a Software-based Redundant Multi-Threading (SRMT) function and a non-SRMT function, the method comprising: maintaining a hash table in a tailing thread for providing control flow outside the SRMT function and the non-SRMT function; and either calling the SRMT function by the non-SRMT function comprising calling an extern version of the SRMT function by the non-SRMT function, and running the SRMT function in a leading thread and the tailing thread, by the extern version of the SRMT function; or calling the non-SRMT function by a leading thread of the SRMT function, and running the non-SRMT function in a single thread.
 10. The method of claim 9, wherein running the non-SRMT function in the single thread further comprises sending a return result by the leading thread of the SRMT function to the tailing thread of the SRMT function.
 11. The method of claim 9, wherein the non-SRMT function comprises at least one of instructions capable of invoking a third party library code and instructions for playing music and video.
 12. The method of claim 9, wherein the non-SRMT function is called by the SRMT function through a pointer.
 13. The method of claim 9, wherein the SRMT function is called by the non-SRMT function through a pointer.
 14. A computer program product embodied on a computer readable storage medium to run a first code generated by a Software-based Redundant Multi-Threading (SRMT) compiler with a second code generated by a non-SRMT compiler, the first code including a first function and a second function, the second code including a third function, the computer program product comprising a program module having instructions for: running the first function in a leading thread and a tailing thread; running the third function in a single thread, wherein the leading thread calls the third function; running the second function in the leading thread and the tailing thread, wherein the third function calls the second function; and running leading and tailing versions of a setjmp or longjmp operation and maintaining a hash table in the tailing version for providing control flow outside the first function, the second function and the third function.
 15. The computer program product of claim 14, wherein running the third function in the single thread further comprising sending the return result by the leading thread to the tailing thread.
 16. The computer program product of claim 14, wherein running the second function in the leading thread and the tailing thread comprises: calling an extern version of the second function by the third function, wherein the extern version of the second function is a wrapper of the second function and is configured to be called directly by the third function; and running the second function in the leading thread and the tailing thread, by the extern version of the second function.
 17. The computer program product of claim 14, wherein the second function comprises at least one of instructions capable of invoking a third party library code and instructions for playing audio and video. 